<?php
/**
 * 服务款审批报审表控制器
 *@author ZhouYP
 * 
 **/
namespace Admin\Controller;
use Common\Controller\AuditparentController;
class ServiceReviewController extends AuditparentController{

	public function _initialize() {
		parent::_initialize();
		$this->deal_model = D("Common/ServiceReview");
		$this->users_model = D("Common/Users");
		$this->att_model = D("Common/Attachment");
		
		$this->check = array('code');
		
		// 当前审批流程
		$this->function = "payment";
		$this->subfunction = "2";
	}
	
	public function index(){
		/**搜索条件**/
		$where = "d.is_deleted <> 1 and d.report_type = 2";
		$this->indexAuditPage($where);
	}

	/**
     *  删除 
     */
	public function delete(){
	    $id = I('get.id', 0, 'intval');
		if(!$id){
			$this->error("请选择要删除的数据！");
		}
		$data = array(
			'id'	=> $id,
			'is_deleted' => 1
		);
		if ($this->deal_model->save($data) !== false) {
			$this->success("删除成功！");
		} else {
			$this->error("删除失败！");
		}
	}

    public function add(){
        $data=M("department");
        $depts = $data->field("id,department_name")->where(array('is_deleted' => array('neq', 1),'department_role' =>array('elt',3) ))->order("id DESC")->select();
        $this->assign("depts", $depts);


        $this->display();   
    }

}
?>